﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using XmlServer.ServiceContracts;
using XmlServer.ServiceImplementation;


namespace EchoOperator
{
    public class Operator : IOperator
    {
        public const string SERVER_NAME = "Echo Operator";
        public const string SERVER_VERSION = "1.0";

        public string Name
        {
            get { return SERVER_NAME; }
        }

        public string Version
        {
            get { return SERVER_VERSION; }
        }

        public string FullName
        {
            get { return String.Format("{0}_{1}", SERVER_NAME, Version); }
        }

        public string Description
        {
            get { return "This operator will repeat/echo the facts from the client, to the server, and back to the client."; }
        }

        /// <summary>
        /// All facts are returned in this operator, so I'm not going to specify the requried and optional facts
        /// </summary>
        public List<IFact> Facts 
        { 
            get { return null;}
        }


        public IResponse ProcessRequest(IRequest request)
        {
            Response response = new Response();
            response.Request = request;
            response.Facts = request.Facts;  // echo all the facts back in the response
            response.StopProcessing = System.Environment.TickCount;
            response.Success = true;
            return response;
        }
    }
}
